from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.ie.webdriver import WebDriver
from selenium.webdriver.support import expected_conditions  as EC
from selenium.webdriver.support.wait import WebDriverWait
path = Service(executable_path=r'C:\Users\Laptop\Desktop\thirty_one\chromedriver.exe')
driver = webdriver.Chrome(service=path)
driver.get('https://baidu.com')

# 判断该元素是否被加入到了dom树中,并不代表该元素可见
WebDriverWait(driver,10).until(EC.presence_of_element_located((By.ID,'su')))
# 判断该元素是否可见
WebDriverWait(driver,10).until(EC.visibility_of_element_located((By.ID,'su')))
# 判断是否至少有一个元素加载出来,就返回True
WebDriverWait(driver,10).until(EC.presence_of_all_elements_located((By.TAG_NAME,'input')))
# 判断aaa这个字符串是否在这个元素中,包含关系
WebDriverWait(driver,10).until(EC.text_to_be_present_in_element((By.TAG_NAME,'input'),'aaa'))